#!/usr/bin/python
# encoding=utf-8
import datetime
import os
import threading

def ExecuteCmd(cmd):
    try:
        print("命令%s开始运行%s" % (cmd, datetime.datetime.now()))
        os.system(cmd)
        print("命令%s结束运行%s" % (cmd, datetime.datetime.now()))
    except:
        print('%s\t 运行失败' % (cmd))


if __name__ == '__main__':
    # 需要执行的文件列表
    cmds = ['ShortConnectionServer.py', 'FTPServer.py']

    # 并行
    threads = []
    for cmd in cmds:
        th = threading.Thread(target=ExecuteCmd, args=(cmd,))
        th.start()
        threads.append(th)

    # 等待线程运行完毕
    for th in threads:
        th.join()


